from flask import Flask
from flask_restful import Resource,Api
from flask_restful.reqparse import RequestParser

app = Flask(__name__)
api = Api(app)

class RegisterView(Resource):
    def post(self):
        #建立解析器
        parser = RequestParser()
        #定义数据解析规则
        parser.add_argument('uname',type=str,help='用户名验证错误',required=True)
        #解析数据
        args = parser.parse_args()
            #正确，直接获取数据
        print(args)
            #错误，回馈到前端
        #响应数据
        return {'msg':'注册成功'}

api.add_resource(RegisterView,'/register/')

if __name__ == '__main__':
    app.run(debug=True)